package com.travel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.travel.domain.entity.Cultural;
import com.travel.service.CulturalService;
import com.travel.mapper.CulturalMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 李健波
* @description 针对表【cultural(文创商品表)】的数据库操作Service实现
* @createDate 2024-11-21 19:09:06
*/
@Service
public class CulturalServiceImpl extends ServiceImpl<CulturalMapper, Cultural>
    implements CulturalService{
    @Autowired
    private CulturalMapper culturalCreativeMapper;

    /**
     * 根据名称模糊查询文创产品
     *
     * @param name 文创产品名称
     * @return 查询结果列表
     */
    public List<Cultural> findByName(String name) {
        LambdaQueryWrapper<Cultural> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(name != null && !name.isEmpty(), Cultural::getName, name);
        return culturalCreativeMapper.selectList(queryWrapper);
    }
}




